﻿#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

typedef struct Salary_s
{
	char name[11];
	float basic;
	float f;
	float out;
}Salary;

typedef struct TContext_s
{
	int n;
	Salary v[1000];
}TContext;

TContext context;

void read_data(TContext* ctx)
{
	scanf("%d", &ctx->n);
	for (int i = 0; i < ctx->n; ++i)
	{
		scanf("%s %f %f %f", ctx->v[i].name, &ctx->v[i].basic, &ctx->v[i].f, &ctx->v[i].out);
	}
}


void do_task(TContext* ctx)
{
	int n = ctx->n;
	for (int i = 0; i < ctx->n; ++i)
	{
		printf("%s %.2f\n", ctx->v[i].name, ctx->v[i].basic + ctx->v[i].f - ctx->v[i].out);
	}
}

void solve(TContext* ctx)
{
	read_data(ctx);
	do_task(ctx);
}

int main()
{
	freopen("D:/Develop/GitRepos/MOOC/浙江大学/数据结构/201906/DataStructure/M2019秋C入门和进阶练习集/7-105.txt", "r", stdin);
	solve(&context);
	return 0;
}
